import java.util.Scanner;


public class AccountManager
{
	//create new account
	//update accounts based on customer id
	//check if customer is in system
	//update account membershiptype
	public static void processRequest(int accountID)
	{
		Scanner input = new Scanner(System.in);
		 CustomerAccount ca=Accounts.retrieveAccount(accountID);
		 System.out.println("Update account information(u) or update membership type(m)?(-1 to cancel)");
		 String doWhat=input.next();
		 if(doWhat.equals("u"))
			 updateAccountInformation(ca);
		 else if(doWhat.equals("m"))
			 updateAccountMembership(ca);
	}
   public static void updateAccountMembership(CustomerAccount ca)
   {
	   Scanner input = new Scanner(System.in);
	   System.out.println("Upgrade(u) or downgrade(d)?(-1 to cancel)");
	    String direction=input.next();
	    if(direction.equals("u"))
	    	ca.getMembership().upgradeMembership();
	    else if(direction.equals("d"))
	    	ca.getMembership().downgradeMembership();
   }
   public static void updateAccountInformation(CustomerAccount ca)
   {
	   Scanner input = new Scanner(System.in);
	   System.out.println("Input name");
	    ca.setName(input.nextLine());
	    System.out.println("Input address");
	    ca.setAddress(input.nextLine());
	    System.out.println("Input email");
	    ca.setEmail(input.nextLine());
	    System.out.println("Input phone number");
	    ca.setPhone(input.nextLine());
	    System.out.println("Account updated.");
   }
   public static CustomerAccount createAccount()
   {
	   Scanner input = new Scanner(System.in);
	   System.out.println("Input name, address, email, and phone number separated by commas");
	    String username = input.nextLine();
	    String accountInfo[]=username.split(",");
	    CustomerAccount c=new CustomerAccount(Accounts.getAccounts().size(), accountInfo[0], accountInfo[1], accountInfo[2], accountInfo[3]);
	   Accounts.add(c);
	   System.out.println("Account Created.");
	   return c;
	   
   }
   
}
